package com.retail.xiaocui.server.look;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.UUID;

//公共锁 类
@Component
public class DIstributedLockClient {

    //注入redisTemplate
    @Autowired
    private StringRedisTemplate redisTemplate;

    private  String uuid;


    public DIstributedLockClient() {

        this.uuid= UUID.randomUUID().toString();
    }


    //调用RedisLuaLook 类 传如参数 锁名称， redisTemplate ，和 uuid
    public RedisLuaLook getRedisLuaLock(String lockName){

        return new RedisLuaLook(redisTemplate,lockName,uuid);
    }

}
